package com.hellogood.work.evaluate.server.serviceImpl;

import java.util.List;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.hellogood.work.evaluate.server.dao.CustomerDAO;
import com.hellogood.work.evaluate.shared.po.Customer;
import com.hellogood.work.evaluate.shared.services.CustomerService;

public class CustomerServiceImpl extends RemoteServiceServlet implements CustomerService {

	private static final long serialVersionUID = 5091753418525342918L;

	@Override
	public int getTotalNumber() {
		return 0;
	}

	@Override
	public List<Customer> getList() {
		CustomerDAO dao = new CustomerDAO();
		return dao.getList();
	}

	@Override
	public String modify(Customer c, boolean isModiy) {
		CustomerDAO dao = new CustomerDAO();
		if (!isModiy) {
			if (dao.getCustomer(c.getCustomerNo()) != null) {
				return "客户编号：" + c.getCustomerNo() + "已经存在";
			}
		}
		return dao.modify(c, isModiy);
	}
}